<template>
	<view>
		<simple-toolbar :title="$t('pool.coinPool.coinPool')">
			<view class="update">
				<view class="button" @click="editCoinPool(1)">
					<image src="../../../static/create.png"></image>
					<text>{{ $t('pool.coinPool.newCoin') }}</text>
				</view>
			</view>
		</simple-toolbar>

		<view class="pad-base table">
			<el-table :data="listData" style="width: 100%">
				<el-table-column align="center" prop="coin_name" :label="$t('pool.coinPool.coin')"></el-table-column>
				<!-- <el-table-column align='center' prop="record_time" :label="$t('pool.coinPool.record_time')"></el-table-column> -->
				<el-table-column align='center' :label="$t('pool.coinPool.operation')" width="80">
					<template slot-scope="scope">
						<el-button @click="editCoinPool(2, scope.row)" type="text" size="small">
							{{ $t('pool.coinPool.modify') }}
						</el-button>
					</template>
				</el-table-column>
			</el-table>
		</view>
	</view>
</template>

<script>
	import {
		getCoinList
	} from "../../../js_sdk/uni-admin/wallet.js"

	export default {
		data() {
			return {
				listData: []
			}
		},
		methods: {
			editCoinPool(state, row) {
				uni.navigateTo({
					url: `./editCoinPool?state=${state}&data=${encodeURIComponent(JSON.stringify(row))}`
				})
			},
		},
		async onShow() {
			let res = await getCoinList()
			this.listData = res.data
			if (this.listData.record_time) {
				this.listData.record_time.forEach(item => {
					item = this.$utils(item)
				})
			}
		},
	}
</script>

<style>

</style>
